package com.soft.javase.day06.datetime.news;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

/**
 * @author yzh
 * @desc TODO
 * @date 2025/4/24
 */
public class News {
    private String title;
    private String content;
    private LocalDateTime time;

    public News(String title, String content, LocalDateTime time) {
        this.title = title;
        this.content = content;
        this.time = time;
    }

    public void display() {
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
        System.out.println("News{" +
                "title='" + title + '\'' +
                ", content='" + content + '\'' +
                ", time=" + formatter.format(time) +
                '}');
    }

    public LocalDateTime getTime() {
        return time;
    }
}
